# -*- coding: utf-8 -*-

from flask import session, redirect, url_for
from functools import wraps


# 没有登录则跳转到登录界面
def check_login(f):
    @wraps(f)
    def need_login(*args, **kwargs):
        if 'member_id' not in session or session['member_id'] is None:
            return redirect(url_for('admin.auth_login'))
        return f(*args, **kwargs)
    return need_login
